import { createApp } from "vue";
import App from "./App.vue";
import VueLuckyCanvas from "@lucky-canvas/vue";

const app = createApp(App);
app.use(VueLuckyCanvas);
app.mount("#app");

// let obj = new Proxy({}, {
//     get: function (target, propKey, receiver) {
//         console.log(`getting ${propKey}!`);
//         return Reflect.get(target, propKey, receiver);
//     },
//     set: function (target, propKey, value, receiver) {
//         console.log(`setting ${propKey}!`);
//         return Reflect.set(target, propKey, value, receiver);
//     }
// });
//
//
// obj.count = 1
// ++obj.count

// const queuedObservers = new Set();

// const observe = (fn) => queuedObservers.add(fn);
// const observable = (obj) => new Proxy(obj, { set });

// function set(target, key, value, receiver) {
//   const result = Reflect.set(target, key, value, receiver);
//   queuedObservers.forEach((observer) => observer());
//   return result;
// }

// const person = observable({
//   name: "张三",
//   age: 20,
// });

// function print() {
//   console.log(`${person.name}, ${person.age}`);
// }

// observe(print);
// setTimeout(() => {
//   person.name = "李四";
// }, 3000);

// setTimeout(() => {
//   console.log(person.name);
// }, 5000);
